package com.dailyblue.java.cloud.dept.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dailyblue.java.cloud.commons.bean.Dept;
import com.dailyblue.java.cloud.commons.util.JsonResult;
import com.dailyblue.java.cloud.commons.util.ResultTool;
import com.dailyblue.java.cloud.dept.mapper.DeptMapper;
import com.dailyblue.java.cloud.dept.service.DeptService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements DeptService {
    @Cacheable(cacheNames = "findAllDept", key = "0")
    public JsonResult find() {
        return ResultTool.success(list());
    }

    @Cacheable(cacheNames = "findDeptById", key = "#id")
    public Dept find(int id) {
        return getBaseMapper().findDeptById(id);
    }
}
